package com.caiyi.tips;

import com.caiyi.tips.core.servlet.RandCodeServlet;
import com.caiyi.tips.core.servlet.YzmServlet;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;

@SpringBootApplication
@MapperScan(basePackages = "com.caiyi.tips.user.mapper")
@EnableRedisHttpSession
public class TipsUserApplication {

	public static void main(String[] args) {
		SpringApplication.run(TipsUserApplication.class, args);
	}

//	@Bean
//	public ServletRegistrationBean randCodeServletRegistration() {
//		ServletRegistrationBean registration = new ServletRegistrationBean(new RandCodeServlet());
//		registration.addUrlMappings("/yzmold.jo");
//		return registration;
//	}

	/**
	 * 图形计算验证码servlet
	 * @return
	 */
	@Bean
	public ServletRegistrationBean yzmServletRegistration() {
		ServletRegistrationBean registration = new ServletRegistrationBean(new YzmServlet());
		registration.addUrlMappings("/yzm.jo");
		return registration;
	}
}
